/**
 * 
 */
package net.zarubsys.unianalyzer.dataminers.lpt.wizard.utils;

import java.util.Arrays;

/**
 * LPTPortConsts
 *
 * @author  &lt;A HREF=&quot;mailto:lukas.zaruba@gmail.com&quot;&gt;Lukas Zaruba&lt;/A&gt
 * @version $Revision$ $Date$
 */
public class LPTConsts {
	private static final String[] portOffsets = new String[] {"0 - data", "1 - status", "2 - control"};
	private static final String[] addressLabels = new String[] {"0x378", "0x278"};
	private static final Integer[] addressValues = new Integer[] {0x378, 0x278};
	private static final String[] frequencyUnitsLabels = new String[] {"Hz", "kHz"};
	private static final Integer[] frequencyUnitsValues = new Integer[] {1, 1000};
	private static final String[] timeUnitsLabels = new String[] { "\u00B5s", "ms", "s" };
	private static final Integer[] timeUnitsValues = new Integer[] {1, 1000, 1000000};
	
	public static String[] getPortOffsets() {
		return portOffsets;
	}
	
	public static String[] getAddressLabels() {
		return addressLabels;
	}
	
	public static Integer[] getAddressValues() {
		return addressValues;
	}
	
	public static String[] getFrequencyUnitsLabels() {
		return frequencyUnitsLabels;
	}
	
	public static Integer[] getFrequencyUnitsValues() {
		return frequencyUnitsValues;
	}
	
	public static String[] getTimeUnitsLabels() {
		return timeUnitsLabels;
	}
	
	public static Integer[] getTimeUnitsValues() {
		return timeUnitsValues;
	}
	
	public static <T> int findValueIndex(T[] array, T value) {
		for (int i = 0; i < array.length; i++) {
			T item = array[i];
			if (item.equals(value)) {
				return i;
			}
		}
		throw new RuntimeException("Cannot find value \"" + value + "\" in array " + Arrays.toString(array) + ".");
	}
	
}


/*
 * $Log$
 */